package com.zk.atm.service.impl;

import com.bpms.common.CommonUtil;
import com.bpms.common.VO;
import com.bpms.eai.PackTool;
import com.bpms.esb.IService;
import com.zk.atm.service.IAtmpDeviceService;

public class AtmpDeviceServiceImpl extends PackTool implements IService,IAtmpDeviceService {

	@Override
	public VO exec(VO args) {

		byte[] body=(byte[])args.getObj("body");
		VO r=new VO();
		try{
			String m=this.getField(body, body.length, "m");
			if(m.equals("deleteOrg")){
				//org_id=
				r.voType="deleteOrg";
				String DEVICE_id=this.getField(body, body.length, "org_id");  //设备号
			}else if(m.equals("orgList")){
				String DEVICENO=this.getField(body, body.length, "1001");  //设备号
				r.voType="orgList";
			}else if(m.equals("saveOrg")){
				String DEVICENO=this.getField(body, body.length, "1001");  //设备号                     
				String NETNUM=this.getField(body, body.length, "1002");   //网点号               
				String BillDateTime=this.getField(body, body.length, "1003");    //日期时间                                                
				r.voType="saveOrg";
			}
			   //1014	影像张数
			
			
			//---------支持多张票据处理方法-----------------------------------------------------------------
			int ipagecount = Integer.parseInt("11");
			for(int i = 1;i <= ipagecount; i++){
				String photo = this.getField(body, body.length, String.format("T%03d", i));
				r.setAttr("photo"+ i, photo);
			}
			//--------------------------------------------------------------------------
			//String photo1 = this.getField(body, body.length, "T001");//第一张影像的base64编码
			//String photo2 = this.getField(body, body.length, "T002");//第二张影像的base64编码
					
			
			
			//r.setAttr("photocount",photocount);
			
			//r.setAttr("photo1",photo1);
			//r.setAttr("photo2",photo2);
			
			CommonUtil.debug("ATM.Parse_atm_bill parseBuffer");
			return r;
		}
		catch(Exception e)
		{
			CommonUtil.debug("Parse_atm_bill exception",e);
			return null;
		}
		
	
	}

}
